﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace Summerset.Isbndb.Books
{
    /// <summary>
    /// Represents MAchine Readable Cataloging information about a publication.
    /// </summary>
    public sealed class BookElementMarc
    {

        #region Constructor + Private Fields

        readonly XmlNode _marcNode;

        /// <summary>
        /// Initializes a new instance of <see cref="BookElementMarc"/>.
        /// </summary>        
        public BookElementMarc (XmlNode marcNode)
	    {
            _marcNode = marcNode;
	    }

        #endregion
        #region Properties

        /// <summary>
        /// Gets the free-form library name that this information was retrieved from.
        /// </summary>
        public string LibraryName
        {
            get { return _marcNode.Attributes["LibraryName"].Value; }
        }

        /// <summary>
        /// Gets the date and time this information was last updated.
        /// </summary>
        public DateTimeOffset LastUpdate
        {
            get { return DateTimeOffset.Parse(_marcNode.Attributes["last_update"].Value); }
        }

        /// <summary>
        /// Gets the Uri for this MARC information.
        /// </summary>
        public Uri MarcUri
        {
            get { return new Uri(_marcNode.Attributes["marc_url"].Value); }
        }

        #endregion

    }
}
